using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Xml.Serialization;
using System.Collections;

namespace TheLogWatcher
{
    [XmlRootAttribute("FormatConfigs", Namespace = "", IsNullable = false)]
    public class FormatConfigs
    {
        public FormatConfigs()
        {
        }

        /// <summary>
        ///     Default name of a new log format.
        /// </summary>
        [XmlElementAttribute("Name")]
        public string Name;

        /// <summary>
        ///     List of all format settings contained in this format definition.
        /// </summary>
        [XmlArray("FormatTypes"), XmlArrayItem("FormatType", typeof(FormatConfigsType))]
        public ArrayList FormatTypes;


        public void addObj(string uid, int defaultProperty, string text, ArrayList properties)
        {
            int x = 5;
            if (this.FormatTypes != null)
            {
                x += this.FormatTypes.Count * 95;
            }
            int y = 1;
            addObj(uid, x, y, defaultProperty, text, properties);
        }

        private void addObj(string uid, int x, int y, int defaultProperty, string text, ArrayList properties)
        {
            FormatConfigsType type = new FormatConfigsType(uid, x, y, defaultProperty, text);
            if (this.FormatTypes == null)
            {
                this.FormatTypes = new ArrayList();
            }
            type.Properties = properties;
            this.FormatTypes.Add(type);
        }
    }
}

